import { BaseController, CoolController } from "@cool-midway/core";
import { OrderItemEntity } from "../../entity/item";
import { ProductInfoEntity } from "../../../product/entity/info";
import { ProductItemEntity } from "../../../product/entity/item";

/**
 * 订单子项
 */
@CoolController({
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    entity: OrderItemEntity,
    pageQueryOp: {
        select: ['a.*', 'b.name as productName', 'c.name as skuName'],
        join: [
            { entity: ProductInfoEntity, alias: 'b', condition: 'a.productId = b.id', type: 'leftJoin' },
            { entity: ProductItemEntity, alias: 'c', condition: 'a.productItemId = c.id', type: 'leftJoin' },
        ],
        fieldEq: ['a.orderId', 'a.productId', 'a.productItemId'],
        keyWordLikeFields: ['b.name']
    }
})
export class ProviderOrderItemController extends BaseController { }


